package com.idata.service.services;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.regex.Pattern;

@Service
public class HighRiskDisputeService implements InitializingBean {

    @Value("${GA.high-risk.words-pattern}")
    private String highRiskWords;

    private Pattern compiler;

    @Override
    public void afterPropertiesSet() throws Exception {
        compiler = Pattern.compile(highRiskWords);
    }

    public boolean isHighRiskDispute(String text) {
        return compiler.matcher(text).find();
    }
}
